<?php  
namespace app\common\services;

use yii\helpers\Html;
use yii\helpers\Url;
class UtilService
{
	//获取ip
	public static function getIp(){
		if( !empty($_SERVER['HTTP_X_FORMARDED_FOR'])){
			return $_SERVER['HTTP_X_FORMARDED_FOR'];
		}
		return $_SERVER['REMOTE_ADDR'];
	}
	//转义
	public static function encode($display){
		return Html::encode($display);
	}
	//根目录
	public static function getRootPath(){
		return dirname(\Yii::$app->getVendorPath());
	}
}

?>